#ifndef SSLSERVERTHREAD_H
#define SSLSERVERTHREAD_H

#include <QThread>
#include <QSslSocket>
#include <QTimer>
#include <QSslCertificate>
#include <QSslCipher>
class SSLServerThread:public QThread{
    Q_OBJECT
public:
    SSLServerThread(int socketDescriptor,QObject* parent=0);
    ~SSLServerThread();
    int getSocketDescriptor() const;
    int getInitSocketDescriptor() const;
protected:
    void run();
    void PrintMsg(const char*);
private slots:
    void _run();
    void datareceive();
    void handleSocketEncrypted();
    void handleSslModeChanged(QSslSocket::SslMode mode);
    void handleSocketConnected();
    void handleSocketDisconnected();
    void handleSocketStateChange(const QAbstractSocket::SocketState & socketState);

    void handleSocketError(const QAbstractSocket::SocketError& socketError);
    void handleSslErrorList(const QList<QSslError>& errorList);
    void handlePeerVerifyError(const QSslError& error);
    void handleSslError(const QSslError& error);
private:
    void requestDestroyed();
signals:
    void socketDisconnected(int initDescriptor);
private:
    int socketDescriptor;
    QSslSocket* socket;
    QTimer *runTimer;
};

#endif // SSLSERVERTHREAD_H
